<template>
  <div class="box" v-show="show">
    <h2>我是弹层</h2>
    <div>内容</div>
    <div>
      <button>取消</button>
      <button @click="emit('update:show', false)">关闭</button>
    </div>
  </div>
</template>

<script setup lang="ts">
// 1. 父传子
defineProps<{
  modelValue: boolean
  show: boolean
}>()
// 2. 子传父
const emit = defineEmits<{
  (e: 'update:modelValue', data: boolean): void
  (e: 'update:show', data: boolean): void
}>()
</script>

<style lang="scss" scoped>
.box {
  width: 200px;
  height: 100px;
  box-shadow: 0 0 7px #000;
}
</style>
